//
//  HLTTimer.swift
//  EastNetWorkProject
//
//  Created by hlt on 2023/10/31.
//

import UIKit

class HLTTimer: NSObject {
    static func execTask(timeout:Int,sourceHandler:@escaping () -> Void) -> DispatchSourceTimer{
       // var timeout = timeout
        let timer = DispatchSource.makeTimerSource(flags:[], queue: DispatchQueue.global())
        timer.schedule(deadline: .now(),repeating: .seconds(1))
        timer.setEventHandler {
            DispatchQueue.main.async {
               sourceHandler()
            }
        }
        timer.resume()
        return timer
    }
}
